<template>
	<view class="container">
		<image class="background-image" src="/static/image-my/Frame 9529.png" mode="scaleToFill"></image>
		<!-- 关注列表 -->
		<scroll-view class="follow-list" scroll-y>
			<view v-if="followList.length === 0" class="empty-tip">
				<image src="/static/empty.png" class="empty-img" mode="aspectFit" />
				<img src="/static/follow-empty.png" alt="">
				<text class="empty-text">您还未关注任何主播哦～</text>
			</view>

			<view class="follow-grid" v-else>
				<view class="list-con">
					<view v-for="item in followList" :key="item.id">
						<view class="list-item">
							<view class="left-item">
								<img src="/static/login/Frame 5.png" alt="">
								<view class="item-name">{{item.name}}</view>
							</view>
							<view :class="[item.statusBtn === true ? 'success-status': 'fail-status']"
								@click="dianji(item)">
								<uni-icons v-if="item.statusBtn === true" type="plus-filled" size="20" color="#fff"></uni-icons>
								<text>{{item.statusBtn === true ? '关注' : '已关注'}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				followList: [{
						id: 1,
						name: '张三',
						statusBtn: true,
					},
					{
						id: 2,
						name: '李四',
						statusBtn: true,
					},
				]

			}
		},
		methods: {
			dianji(item) {
				item.statusBtn = !item.statusBtn;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		position: relative;
		display: flex;
		flex-direction: column;
		height: calc(100vh - 88rpx);
		background-color: #f7f7f7;
		width: 100vw;
		overflow: hidden;
	}

	.background-image {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 400rpx;
		z-index: 0;
	}

	.header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 15px 20px;
		background-color: #fff;
		border-bottom: 1px solid #f0f0f0;

		.title {
			font-size: 18px;
			font-weight: 600;
			color: #333;
		}

		.clear-btn {
			font-size: 14px;
			color: #666;
		}
	}

	.follow-list {
		flex: 1;
		background-color: #f7f7f7;
	}

	.empty-tip {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 60vh;

		.empty-img {
			width: 120px;
			height: 120px;
			opacity: 0.5;
			margin-bottom: 15px;
		}

		.empty-text {
			font-size: 14px;
			color: #999;
		}
	}

	.follow-grid {
		// width: 100%;
		display: grid;
		grid-template-columns: 1fr;
		gap: 12rpx;

		.list-con {
			height: 60vh;
			background-color: #fff;
			margin: 30rpx;
			border-radius: 20rpx;
			box-shadow: 0 4rpx 12rpx 0 rgba(0, 0, 0, 0.08);

			.list-item {
				display: flex;
				border-bottom: 1rpx solid #EEEEEE;
				margin: 30rpx;
				justify-content: space-between;

				.left-item {
					display: flex;

					img {
						width: 60rpx;
						height: 60rpx;
					}

					.item-name {
						display: flex;
						align-items: center;
					}
				}

				.fail-status, .success-status{
					width: 110rpx;
					height: 48rpx;
					border-radius: 100rpx 100rpx 100rpx 100rpx;
					font-size: 24rpx;
					color: #fff;
					text-align: center;
					line-height: 48rpx;
					display: flex;
					justify-content: center;
				}
				.fail-status {
					background: #79879E;
				}

				.success-status {
					background: #2D7AF7;
				}
			}
		}
	}
</style>